package com.automobile.backstage.service.impl;

import java.util.List;

import com.automobile.backstage.dao.ImgDao;
import com.automobile.backstage.domain.Img;
import com.automobile.backstage.service.ImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;


@Service("imgService")
public class ImgServiceImpl implements ImgService {
	
	@Autowired
	private ImgDao imgDao;
	
	public List<Img> findImg(int announceId) {
		List<Img> imgs = imgDao.findImgs(announceId);
		return imgs;
	}

	public void save(List<Img> imgs) {
		for(Img img : imgs) {
			imgDao.save(img);
		}
	}

	public void update(List<Img> imgs) {
		for(Img img : imgs) {
			imgDao.update(img);
		}
	}
	
	public void delete(int id) {
		imgDao.delete(id);
	}

    @Override
    public void deleteBySmartId(int smartId) {
        imgDao.deleteBySmartId(smartId);
    }

    @Override
    public void deleteByAnnounceId(int announceId) {
        imgDao.deleteByAnnounceId(announceId);
    }

    public void save(Img img) {
		imgDao.save(img);
	}

    @Override
    public void save2(List<Img> imgs) {
        for(Img img : imgs){
            imgDao.save2(img);
        }
    }

    @Override
    public void save2(Img ims) {
        imgDao.save2(ims);
    }

}
